import os
import sys

if __name__ == '__main__':
    # get the screen data form  shouji xxxx screen 目录
    os.system("mv ../shouji/nokiax5/screen/* ./predata/")
    dirPredata = os.listdir("./predata")
    for dir in dirPredata:
        print(dir)
        if not 'py' in dir  and not 'Store' in dir:
            imgfiles =os.listdir("./predata/"+dir)
            for imgfile in imgfiles:
                print(imgfile)
                if 'png' in imgfile:
                    imgfilePrefix = imgfile.split('.')[0]
                    #os.system("convert \"./predata/"+dir+"/"+imgfile+"\"   \"./predata/"+dir+"/"+imgfilePrefix+".jpg\"")
                    #os.system("rm \"./predata/"+dir+"/"+imgfile+"\"")
    os.system("cp -R ./predata/* ./mit-train/ ")
    os.system("rm -rf ./predata/*")
    os.system("python build_features.py ")
    os.system("python trainer.py ")


#